package maitreEsclave;

import java.rmi.*;
import java.rmi.registry.LocateRegistry;

public class ProgEsclave {
    public static void main(String[] argv) {
    	// arg0 le port du maitre
    	// arg1 le port des esclaves
    	// le nom du maitre
    	
	try {
		Calcule hello = new Calcule(argv[2],argv[0]);
		new Thread(hello).start();
		LocateRegistry.createRegistry(Integer.parseInt(argv[1]));
	    Naming.rebind("rmi://localhost:"+argv[1]+"/Esclave",hello);
	    System.out.println("Slave is ready.");
	} catch(Exception e) {
	    System.out.println("Slave failed: "+e);
	}
    }
}
